home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 11 - 1995 / 11.02 Feb 95 / 11.02 Getting Started / ListTester / Link.cp next >
Encoding:
Text File  |  1994-12-02  |  1.2 KB  |  38 lines  |  [TEXT/MMCC]

  1. /*
  2.     File:        LinkedList.cp
  3.  
  4.     Contains:    A linked list
  5.     Written by: Dave Mark
  6.     Copyright:    © 1994 by Dave Mark, all rights reserved.
  7.  */
  8.  
  9. #include "Link.h"
  10.  
  11. // TOPIC: Mention singly linked list idea from Scott, where you 
  12. //        cinch the singly linked list by copying the next element into the to-be-deleted-element, then
  13. //        fix the pointers, then delete the next elemenbt instead. 
  14. //        Note that this strategy requires you to keep a semaphore link as the last link in the list and 
  15. //        that you can't del;ete the semaphore link.
  16.  
  17. // TOPIC: The reader should investigate Enque() and Deque(), especially if you
  18. //        need your linked list to operate at inturrupt time, which is likely if you are doing a lot
  19. //        of async processing, as you might do if you were
  20. //        writing a web server or some such.
  21. //        You might implement this as a series of three queues: a queue of preallocated queue elements, 
  22. //        (so you don't yhave to allocate memory at interrupt time)
  23. //        another queue of "in-progress" elements (async reads waiting to complete)
  24. //        
  25. //        also a queue of "this is done, take care of it at main-event time"
  26. //        
  27.  
  28. TLink::TLink( void *objectPtr )
  29. {
  30.     fObjectPtr = objectPtr;
  31.     fPrevLinkPtr = nil;
  32.     fNextLinkPtr = nil;
  33. }
  34.  
  35.  
  36. TLink::~TLink()
  37. {
  38. }